package com.myapplication.ui.homefragment.shopfragment.activity_banner.activity_banner1;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.myapplication.R;
import com.myapplication.bean.DeatilBanner1;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;


/**
 * Created by zitaojiang on 2016/10/17.
 */
public class Activity_Banner1 extends AppCompatActivity implements Contract_Banner1.View {

    private Contract_Banner1.Presenter mPresenter;
    List<DeatilBanner1.RowsBean> mList;
    private MyBannerAdapter adapter;
    private RecyclerView recyclerView;
    @Bind(R.id.iv_collapsing)
    ImageView ivCollapsing;
    @Bind(R.id.toolbar_collapsing)
    Toolbar toolbarCollapsing;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_banner1);
        ButterKnife.bind(this);
        mPresenter=new Presenter_Banner1(this);
        mPresenter.putData();
        Intent intent = getIntent();
        String i = intent.getStringExtra("imgUrl1");
        Glide.with(this).load(i).into(ivCollapsing);
        recyclerView= (RecyclerView) findViewById(R.id.recycler_View);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));

    }

    @Override
    public void onGetDataSuuessful_Banner1(List<DeatilBanner1.RowsBean> rows) {
        mList=rows;
        Log.i("tag3", "onGetDataSuuessful_Banner1: "+mList.get(0).getName());
        adapter=new MyBannerAdapter(mList,this);
       recyclerView.setAdapter(adapter);

    }

    @Override
    public void onGetDataFail_Banner1(String error) {
        Log.i("tag4","-------------"+error);

    }
}
